<?php

namespace Rakit\Validation\Rules;

use Rakit\Validation\Rule;

class Mobile extends Rule
{
    use Traits\SizeTrait;

    /** @var string */
    protected $message = "The :attribute is not a valid mobile phone";

    /** @var array */
    protected $fillableParams = ['mobile'];

    /**
     * Check the $value is valid
     *
     * @param mixed $value
     * @return bool
     */
    public function check($value): bool
    {
        //规则放宽一些，1开头的11位数字即可
        return preg_match('/^1[0-9]{10}$/',$value,$match) > 0 ? true : false;
    }
}
